IF OBJECT_ID('ssf.job_get_job_name') IS NOT NULL
	DROP FUNCTION ssf.job_get_job_name
GO

CREATE FUNCTION ssf.job_get_job_name (
	@job_id UNIQUEIDENTIFIER
)
RETURNS NVARCHAR(128)
AS
BEGIN
/*
<object_header>

<object_summary>
	<purpose><![CDATA[
Get name of given job id.
	]]></purpose>
</object_summary>

<parameter_dependency>
	<parameter_name>@job_id</parameter_name>
	<parameter_desc><![CDATA[Id of a job.]]></parameter_desc>
</parameter_dependency>

</object_header>
*/

	RETURN (
		SELECT [name]
		FROM msdb.dbo.sysjobs WITH (NOLOCK)
		WHERE job_id = @job_id
	)
END
GO
